using System;
using System.Collections.Generic;
using System.Text;
using System.ServiceModel;
using System.Runtime.Serialization;

namespace WCFServiceExample
{
    [ServiceContract()]
    public interface IMyService
    {
        [OperationContract]
        OutputObject  doAction(InputObject parameter);
    }

    public class MyServiceImpl : IMyService
    {
        #region IMyService Members
        public OutputObject doAction(InputObject parameter)
        {
            OutputObject obj = new OutputObject();
            obj.Message = String.Format("Hello {0} {1}!", parameter.FirstName, parameter.LastName);
            return obj;
        }
        #endregion
    }

    [DataContract]
    public class InputObject
    {
        string firstName;
        string lastName;

        [DataMember]
        public string FirstName
        {
            get { return firstName; }
            set { firstName = value; }
        }

        [DataMember]
        public string LastName
        {
            get { return lastName; }
            set { lastName = value; }
        }
    }

    [DataContract]
    public class OutputObject
    {
        string message;
        [DataMember]
        public string Message
        {
            get { return message; }
            set { message = value; }
        }
    }

}
